<?php

namespace Part09_PrototypeMode\Code4;

class Resume
{
    private $name;
    private $sex;
    private $age;
    private $work;

    public function __construct($name)
    {
        $this->name = $name;
        $this->work = new WorkExperience();
    }

    // 设置个人信息
    public function setPersonalInfo($sex, $age)
    {
        $this->sex = $sex;
        $this->age = $age;
    }

    // 设置工作经历
    public function setWorkExperience($timeArea, $company)
    {
        $this->work->setWorkDate($timeArea);
        $this->work->setCompany($company);
    }

    // 显示
    public function display()
    {
        echo "$this->name $this->sex $this->age
            工作经历： {$this->work->getWorkDate()} {$this->work->getCompany()}\n";
    }

    // 克隆自身
    public function cloneObj()
    {
        return clone $this;
    }
}